package com.demo.webapp.jcaptcha.security.authentication;

import java.util.Collection;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

/**
 * 带有验证码的账号密码安全Token
 * 
 * @author ryuu.kk  at 2013-06-19
 */
public class CaptchaAndUsernamePasswordAuthenticationToken extends UsernamePasswordAuthenticationToken {

	/**
	 * 版本序列化ID
	 */
	private static final long serialVersionUID = 476883234208927657L;
	// 验证码
	private Object captcha;
	// sessionID
	private String sessionId;
	
	public CaptchaAndUsernamePasswordAuthenticationToken(Object principal, Object credentials, Object captcha, String sessionId) {
		super(principal, credentials);
		this.captcha = captcha;
		this.sessionId = sessionId;
	}

    public CaptchaAndUsernamePasswordAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities, Object captcha, String sessionId) {
        super(principal, credentials, authorities);
        this.captcha = captcha;
		this.sessionId = sessionId;
    }

	public Object getCaptcha() {
		return captcha;
	}

	public String getSessionId() {
		return sessionId;
	}
}
